package com.butterfly.hotkey.client.core.netty;

import com.butterfly.hotkey.client.core.service.WorkerService;
import io.netty.channel.Channel;

/**
 * server地址模型
 *
 * @author butterfly
 * @since 2025/2/23
 */
public class NettyServerModel implements Comparable<NettyServerModel> {

    /**
     * 地址信息
     */
    private String address;

    /**
     * netty channel
     */
    private Channel channel;

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public void setChannel(Channel channel) {
        this.channel = channel;
    }

    public Channel getChannel() {
        return channel;
    }

    @Override
    public int compareTo(NettyServerModel o) {
        //按address排序
        return this.address.compareTo(o.address);
    }

    @Override
    public String toString() {
        return "Server{" +
                "address='" + address + '\'' +
                ", channel=" + channel +
                '}';
    }
}
